<?php  
class ControllerModuleArticleAuthor extends Controller {
	protected function index($setting) {
	if($this->config->get('config_news_installed')==1){
		$this->load->model('news/author');
		$this->language->load('module/article_author');
		
    	
		$this->data['text_register'] = $this->language->get('text_register');
    	$this->data['text_login'] = $this->language->get('text_login');
		$this->data['text_logout'] = $this->language->get('text_logout');
		$this->data['logout'] = $this->url->link('news/logout', '', 'SSL');
		$this->data['text_forgotten'] = $this->language->get('text_forgotten');
		$this->data['text_account'] = $this->language->get('text_account');
		$this->data['text_edit'] = $this->language->get('text_edit');
		$this->data['text_password'] = $this->language->get('text_password');
		$this->data['text_wishlist'] = $this->language->get('text_wishlist');
		$this->data['text_order'] = $this->language->get('text_order');
		$this->data['text_download'] = $this->language->get('text_download');
		$this->data['text_return'] = $this->language->get('text_return');
		$this->data['text_transaction'] = $this->language->get('text_transaction');
		$this->data['text_newsletter'] = $this->language->get('text_newsletter');
		
		$this->data['logged'] = $this->author->isLogged();
		$this->data['register'] = $this->url->link('news/register', '', 'SSL');
    	$this->data['login'] = $this->url->link('news/login', '', 'SSL');
		$this->data['forgotten'] = $this->url->link('news/forgotten', '', 'SSL');
		$this->data['account'] = $this->url->link('news/account', '', 'SSL');
		$this->data['edit'] = $this->url->link('news/edit', '', 'SSL');
		$this->data['password'] = $this->url->link('news/password', '', 'SSL');
		$this->data['newsletter'] = $this->url->link('news/newsletter', '', 'SSL');
		
    	$this->data['heading_title'] = $this->language->get('heading_title');
    	$this->data['text_filter_post'] = $this->language->get('text_filter_post');
    	$this->data['text_all_author'] = $this->language->get('text_all_author');
    	$this->data['text_become_author'] = $this->language->get('text_become_author');
		$this->data['style'] = $setting['style'];
		$this->data['author_list'] = $this->url->link('news/author');
		if (isset($this->request->get['author_id'])) {
		$this->data['author_id'] = $this->request->get['author_id'];
		}else{
		$this->data['author_id'] = FALSE;		
		}
		$this->data['authors'] = array();

		foreach ($this->model_news_author->getAuthors() as $result) {
      		$this->data['authors'][] = array(
        		'author' => $result['author'],
        		'author_id' => $result['author_id'],
	    		'href'  => $this->url->link('news/author/info', 'author_id=' . $result['author_id'])
      		);
    	}
		
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/blog/article_author.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/module/blog/article_author.tpl';
		} else {
			$this->template = 'default/template/module/blog/article_author.tpl';
		}
		
		$this->render();
	}
	}
}
?>